/**
 * 给定数组，问[L, R]区间的原始是否各不相同
 * 记录Cnt与种类，如果区间内的数有R - L + 1种，则说明各不相同
 */
#include <bits/stdc++.h>
using namespace std;

struct MoAlgo{ // 莫队算法

using data_t = int;  // 原始数据类型
using answer_t = int; // 要查询的信息的类型

int N;
vector<data_t> OriginArr; // 原始数组，1base

struct q_t{
    int s;
    int e;
    int idx;
};

int Q;
vector<q_t> Problems;
vector<answer_t> Ans;

/// 输入原始数组与查询
void input(){
    cin >> N >> Q;
    OriginArr.assign(N + 1, {});
    for(int i=1;i<=N;++i) cin >> OriginArr[i];

    Problems.assign(Q, {});
    Ans.assign(Q, 0);

    for(int i=0;i<Q;++i){
        cin >> Problems[Problems[i].idx = i].s >> Problems[i].e;
    }

    return;
}

/// 莫队算法，跑完以后答案保存在Ans
void run(){
    sort(Problems.begin(), Problems.end(), [](const q_t&a,const q_t&b){
        int an = a.s / block_size();
        int bn = b.s / block_size();
        return an < bn or (an == bn and a.e < b.e);
    });

    int curLeft = 1;
    int curRight = 0;
    _init();
    for(int i=0;i<Q;++i){
        while(curRight < Problems[i].e) _insert(++curRight);
        while(curLeft > Problems[i].s) _insert(--curLeft);
        while(curRight > Problems[i].e) _remove(curRight--);
        while(curLeft < Problems[i].s) _remove(curLeft++);
        _record(i); 
    }
}

/// 一个BLOCK的大小, 1E5~300, 2E5~450
static int block_size(){
    static int const BLOCK_SIZE = 300; 
    return BLOCK_SIZE;
}

int Diff;
vector<int> Val2Cnt;

void _init(){
    Diff = 0;
    Val2Cnt.assign(N + 1, 0);
}

void _insert(int pos){
    // assert(0);
    auto v = OriginArr[pos];
    auto c = ++Val2Cnt[v];
    if(c == 1) Diff += 1;
}

void _remove(int pos){
    // assert(0);
    auto v = OriginArr[pos];
    auto c = --Val2Cnt[v];
    if(0 == c) Diff -= 1;
}

void _record(int idx){
    // assert(0);
    Ans[Problems[idx].idx] = Problems[idx].e - Problems[idx].s + 1 == Diff ? 1 : 0;
}

};



int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    MoAlgo Mo;
    Mo.input();
    Mo.run();
    for(auto a : Mo.Ans){
        cout << (a ? "Yes\n" : "No\n");
    }
    return 0;
}